;;; stil-mode.el - STIL (IEEE 1450) file editing commands for Emacs ;;; Copyright (C) 2002 Inovys Corporation. ;;; ;;; Author: Kayvan Sylvan ;;; Changes: Peter_GH_Hwang@inovys.com 20020503 ;;; Replaced the "+" in the 'Ann' regexp with a "*" ;;; Added BinMap ;;; Under the terms of the "GNU Service Directory", this file is Free ;;; Software. See the GNU General Public License for details. ;;; This software is provided as-is, without express or implied ;;; warranty. Permission to use, copy, modify, distribute or sell this ;;; software, without fee, for any purpose and by any individual or ;;; organization, is hereby granted, provided that the above copyright ;;; notice and this paragraph appear in all copies. (defconst stil-mode-version "0.3" "`stil-mode' version number.") ;;; TODO: ;;; ======================================================================== ;;; (1) Go over the syntax table with a fine-tooth comb. Needs to incorporate ;;; more of the information in IEEE 1450 standard document with regard ;;; to Table 2 (STIL reserved characters). ;;; ;;; (2) Similarly, the reserved keywords need to be verified/validated. ;;; A complete formal BNF grammar would be useful in this step, along ;;; with the information from Table 6 (namespaces) and Table 7 (top-level ;;; statements and ordering requirements). ;;; ;;; (3) Extend STIL-mode to do more intelligent highlighting. For example: ;;; namespaces and top-level statements can be highlighted/bolded ;;; in ways to distinguish them from other reserved keywords. ;;; ;;; (4) Source-navigation, tags files, more intelligent indentation code ;;; (there are cases where C/C++ indentation rules will do the wrong ;;; thing). ;;; ;;; (5) Highlighting of identifiers and integrated auto-abbrev code. ;;; This would automatically add inserted identifiers into a dynamic ;;; abbrev table, making the input of STIL files a lot easier with the ;;; use of normal Emacs abbrev-mode functions. ;;; ;;; (6) Program `validate-stil-buffer' function to check a STIL buffer for ;;; formal conformance (order of top-level statements, correspondence ;;; of keywords to their enclosing blocks, matching parenthesis, etc.) ;;; This would be extensive, in effect putting the IEEE 1450 spec into ;;; an Emacs Lisp function. ;;; This is a major mode for editing STIL files. ;;; Visit http://grouper.ieee.org/groups/1450/ for more details. ;;; Add the following to .emacs in order to autoload stil-mode (you need ;;; to have put this file in a directory on your load-path): ;;; ;;; (autoload 'stil-mode "stil-mode") ;;; (setq auto-mode-alist (nconc '(("\\.stil$" . stil-mode)) auto-mode-alist)) ;;; (add-hook 'stil-mode-hook 'turn-on-font-lock) ;; Since STIL file syntax can be approached as a subset of C++ (complete ;; with C++ style comments), we will define stil-mode as a derived mode ;; of the standard Emacs c++-mode. (defconst stil-font-lock-keywords (list ;; STIL keywords (cons "Ann[ ]*{\\*.*\\*}" 'font-lock-comment-face) (cons (regexp-opt '("STIL" "Header" "Title" "Date" "Source" "History" "Include" "UserKeywords" "UserFunctions" "Signals" "In" "Out" "InOut" "Supply" "Pseudo" "ScanIn" "ScanOut" "Base" "Alignment" "DataBitCount" "Termination" "TerminateHigh" "TerminateLow" "TerminateOff" "TerminateUnknown" "DefaultState" "ForceUp" "ForceDown" "ForceOff" "Hex" "Dec" "LSB" "MSB" "SignalGroups" "Start" "Stop" "Termination" "PatList" "PatternExec" "PatternBurst" "Timing" "WaveformTable" "Period" "Waveforms" "InheritWaveformTable" "SubWaveforms" "InheritWaveform" "Duration" "ForceDown" "ForceUp" "ForceOff" "ForcePrior" "CompareLow" "CompareHigh" "CompareUnknown" "CompareOff" "CompareValid" "CompareLowWindow" "CompareHighWindow" "CompareOffWindow" "CompareValidWindow" "ForceUnknown" "LogicLow" "LogicHigh" "LogicZ" "Unknown" "ExpectHigh" "ExpectLow" "ExpectOff" "Marker" "Spec" "Category" "Variable" "Min" "Max" "Typ" "Selector" "Meas" "ScanStructures" "ScanChain" "ScanLength" "ScanOutLength" "ScanCells" "ScanMasterClock" "ScanSlaveClock" "ScanInversion" "Pattern" "SourceFile" "BinaryDir" "Loop" "MatchLoop" "BreakPoint" "Infinite" "Call" "Macro" "GoTo" "Stop" "ScanChain" "IddqTestPoint" "TimeUnit" "WaveFormTable" "Vector" "Condition" "Bin" "BinMap" "ProgramResult" "BinNumber" "ProgSeq" "Segment" "Type" "Test" "Position" "Action" "SequenceName" "PinList" "Sites" "Procedures" "Shift" "TestParams" "Method" "Current" "MacroDefs") 'words) 'font-lock-keyword-face)) ) ;;;###autoload (define-derived-mode stil-mode c++-mode "STIL" "Major mode for editing STIL files. This is much like C++ mode except for the keywords and some syntax differences. Turning on STIL mode runs `stil-mode-hook'." (make-local-variable 'comment-start-skip) (make-local-variable 'comment-end-skip) (setq font-lock-defaults '(stil-font-lock-keywords nil nil ((?_ . "w")))) (setq comment-start-skip "/\\*+ *\\|//+ *\\|{\\*") (setq comment-end-skip "[ ]*\\(\\s>\\|\n\\|\\*}\\)") (run-hooks 'stil-mode-hook) ) (provide 'stil-mode) ;;; stil-mode.el ends here